<template>
  <div class="dashboard">
    <div class="dashboard-header">
      <h1>工作台</h1>
      <p>欢迎使用餐饮系统员工端</p>
    </div>
    
    <div class="dashboard-content">
      <div class="module-grid">
        <div class="module-card" @click="navigateTo('/order')">
          <div class="module-icon order-icon">
            <el-icon size="40"><Food /></el-icon>
          </div>
          <h3>点餐</h3>
          <p>处理客户点餐订单</p>
        </div>
        
        <div class="module-card" @click="navigateTo('/pickup')">
          <div class="module-icon pickup-icon">
            <el-icon size="40"><TakeawayBox /></el-icon>
          </div>
          <h3>取餐</h3>
          <p>管理客户取餐订单</p>
        </div>
        
        <div class="module-card" @click="navigateTo('/table')">
          <div class="module-icon table-icon">
            <el-icon size="40"><Grid /></el-icon>
          </div>
          <h3>桌位</h3>
          <p>管理餐厅桌位状态</p>
        </div>
        
        <div class="module-card" @click="navigateTo('/orders')">
          <div class="module-icon orders-icon">
            <el-icon size="40"><Document /></el-icon>
          </div>
          <h3>订单</h3>
          <p>查看和管理所有订单</p>
        </div>
        
        <div class="module-card" @click="navigateTo('/dish')">
          <div class="module-icon dish-icon">
            <el-icon size="40"><Menu /></el-icon>
          </div>
          <h3>菜品管理</h3>
          <p>管理菜品信息和库存</p>
        </div>
        
        <div class="module-card" @click="navigateTo('/report')">
          <div class="module-icon report-icon">
            <el-icon size="40"><TrendCharts /></el-icon>
          </div>
          <h3>报表</h3>
          <p>查看销售和营收报表</p>
        </div>
        
        <div class="module-card" @click="navigateTo('/settings')">
          <div class="module-icon settings-icon">
            <el-icon size="40"><Setting /></el-icon>
          </div>
          <h3>系统设置</h3>
          <p>配置系统参数和设置</p>
        </div>
      </div>
    </div>
    
    <!-- 快速统计 -->
    <div class="quick-stats">
      <el-row :gutter="20">
        <el-col :span="6">
          <el-card class="stat-card">
            <div class="stat-content">
              <div class="stat-icon">
                <el-icon size="24"><Document /></el-icon>
              </div>
              <div class="stat-info">
                <div class="stat-number">{{ todayOrders }}</div>
                <div class="stat-label">今日订单</div>
              </div>
            </div>
          </el-card>
        </el-col>
        
        <el-col :span="6">
          <el-card class="stat-card">
            <div class="stat-content">
              <div class="stat-icon">
                <el-icon size="24"><Money /></el-icon>
              </div>
              <div class="stat-info">
                <div class="stat-number">¥{{ todayRevenue }}</div>
                <div class="stat-label">今日营收</div>
              </div>
            </div>
          </el-card>
        </el-col>
        
        <el-col :span="6">
          <el-card class="stat-card">
            <div class="stat-content">
              <div class="stat-icon">
                <el-icon size="24"><User /></el-icon>
              </div>
              <div class="stat-info">
                <div class="stat-number">{{ activeTables }}</div>
                <div class="stat-label">在用桌位</div>
              </div>
            </div>
          </el-card>
        </el-col>
        
        <el-col :span="6">
          <el-card class="stat-card">
            <div class="stat-content">
              <div class="stat-icon">
                <el-icon size="24"><Food /></el-icon>
              </div>
              <div class="stat-info">
                <div class="stat-number">{{ availableDishes }}</div>
                <div class="stat-label">可售菜品</div>
              </div>
            </div>
          </el-card>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()

// 统计数据
const todayOrders = ref(0)
const todayRevenue = ref(0)
const activeTables = ref(0)
const availableDishes = ref(0)

const navigateTo = (path) => {
  router.push(path)
}

onMounted(() => {
  // 模拟获取统计数据
  todayOrders.value = 25
  todayRevenue.value = 1250.50
  activeTables.value = 8
  availableDishes.value = 45
})
</script>

<style scoped>
.dashboard {
  padding: 20px;
}

.dashboard-header {
  text-align: center;
  margin-bottom: 40px;
}

.dashboard-header h1 {
  font-size: 32px;
  color: #303133;
  margin-bottom: 8px;
}

.dashboard-header p {
  font-size: 16px;
  color: #909399;
}

.dashboard-content {
  margin-bottom: 40px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.module-card {
  background: #fff;
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid #e4e7ed;
}

.module-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.module-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: #fff;
}

.order-icon { background: linear-gradient(135deg, #ff6b6b, #ee5a24); }
.pickup-icon { background: linear-gradient(135deg, #ff9ff3, #f368e0); }
.table-icon { background: linear-gradient(135deg, #feca57, #ff9ff3); }
.orders-icon { background: linear-gradient(135deg, #48dbfb, #0abde3); }
.dish-icon { background: linear-gradient(135deg, #1dd1a1, #10ac84); }
.report-icon { background: linear-gradient(135deg, #5f27cd, #341f97); }
.settings-icon { background: linear-gradient(135deg, #ff9ff3, #f368e0); }

.module-card h3 {
  font-size: 20px;
  color: #303133;
  margin-bottom: 8px;
}

.module-card p {
  color: #909399;
  font-size: 14px;
}

.quick-stats {
  margin-top: 40px;
}

.stat-card {
  border: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.stat-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-info {
  flex: 1;
}

.stat-number {
  font-size: 24px;
  font-weight: 600;
  color: #303133;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: #909399;
}
</style> 